package com.example.design.ddd.practice.domain.orgmng.repository;

import com.example.design.ddd.practice.domain.orgmng.entity.Org;
import com.example.design.ddd.practice.domain.orgmng.entity.OrgStatus;

import java.util.Optional;
/**
 * @Description
 * @Author liuzhihui
 * @Date 2024/5/31
 */
public interface OrgRepository {
    Optional<Org> findByIdAndStatus(long tenantId, Long id , OrgStatus status);

    Optional<Org> findById(Long tenantId, Long id);
    int countBySuperiorAndName(long tenantId, Long superiorId , String name);
    boolean existsBySuperiorAndName(Long tenant, Long superior , String name);
    Org save(Org org);

    Boolean existsByIdAndStatus(Long tenantId, Long orgId, OrgStatus orgStatus);

    boolean existsBySuperiorIdAndName(Long tenant, Long superior, String name);
    int update(Org org);

}
